<%@page language="Java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="includes/head.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Users</title>
</head>
<body>
	<f:view>
	<span id="whole-page-wrapper">
			<div id="wrapper" align="center">
			<%@include file="includes/header.jsp" %>
			<%@include file="includes/menu.jsp" %>	
					
				<div id="content">
					<div id="inner-content">
					<c:if test="${sessionScope.user.loggedUser != null }">
						<c:if test="${sessionScope.user.loggedUser.type == 'Admin' }">
							<h3><a href="newUser.jsp">Dodaj użytkownika do bazy danych</a></h3>
						</c:if>
						<br>
						<c:if test="${sessionScope.users == null }">
							Lista użytkowników jest pusta 
						</c:if>
						<%! int i=0; %>
						<h:form>
				
						<c:forEach var="user1" items="#{users}"> 
								<h3 ><h:commandLink action="user" value="#{user1.fullName}" > 
								<f:setPropertyActionListener value="#{user1}" target="#{user.selectedUser}"/>
								</h:commandLink></h3>
								<% i++; %>
							
						</c:forEach>
						</h:form>
						<% i=0; %>	
					</c:if>
					<c:if test="${sessionScope.user.loggedUser == null }">
						Nie masz uprawnień do korzystania z tej strony!
					</c:if>
					</div>
				</div>
					<%@include file="includes/footer.jsp" %>
				</div>
		</span>
		</f:view>
</body>
</html>